import { useDict } from '@/composables/useDict'
import type { TableColums, FormItemRows } from '@meetjs/element-plus-kit'
import { ATHLETE_DICT } from '@/constants/dictKeys'

const { dicts } = useDict([ATHLETE_DICT.PROJECT, ATHLETE_DICT.LEVEL])
// 表格列配置
export const tableColumns: TableColums[] = [
	{
		prop: 'testTime',
		label: '测试时间',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'testProjectLabel',
		label: '测试项目',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'testPlace',
		label: '测试地点',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'seedLevelLabel',
		label: '苗子级别',
		minWidth: 100,
		align: 'center'
	},
	{
		prop: 'remark',
		label: '备注',
		minWidth: 120,
		align: 'center'
	},
	{
		prop: 'action',
		label: '操作',
		minWidth: 160,
		fixed: 'right',
		align: 'center'
	}
]

// 表单配置
export const formOptions: FormItemRows[] = [
	{
		type: 'date-picker',
		label: '测试时间',
		prop: 'testTime',
		required: true,
		attrs: {
			type: 'date',
			placeholder: '请选择测试时间',
			format: 'YYYY-MM-DD',
			'value-format': 'YYYY-MM-DD'
		}
	},
	{
		type: 'select',
		label: '测试项目',
		prop: 'testProjectId',
		required: true,
		options: dicts[ATHLETE_DICT.PROJECT] as unknown as any
	},
	{
		type: 'input',
		label: '测试地点',
		prop: 'testPlace',
		required: true
	},
	{
		type: 'select',
		label: '苗子级别',
		prop: 'seedLevel',
		options: dicts[ATHLETE_DICT.LEVEL] as unknown as any,
		required: true
	},
	{
		type: 'textarea',
		label: '备注',
		prop: 'remark'
	}
]
